﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel.Channels;
using suanpan.API.Components.Channels.Core;

namespace suanpan.API.Components.Channels.OAuth
{
    class OAuthChannelListener : RestChessChannelListener
    {

        #region Properties


        #endregion

        #region CTor

        public OAuthChannelListener(BindingContext context) : base(context) { }

        #endregion

        #region Overriden Methods

        protected override IReplyChannel OnAcceptChannel(TimeSpan timeout)
        {
            IReplyChannel innerChannel = this.InnerChannelListener.AcceptChannel(timeout);
            if (innerChannel == null)
            {
                return null;
            }
            else
            {
                return new OAuthChannel(this, (IReplyChannel)innerChannel);
            }
        }

        protected override IReplyChannel OnEndAcceptChannel(IAsyncResult result)
        {
            IReplyChannel innerChannel = this.InnerChannelListener.EndAcceptChannel(result);
            return new OAuthChannel(this, (IReplyChannel)innerChannel);
        }
        #endregion

    }
}
